/**
 * 
 */
package com.cqan.common;

import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.Map.Entry;
import java.util.Set;

import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MultivaluedMap;

import com.google.common.collect.Maps;

/**
 * @Description TODO
 * @author slaton.wu@gmail.com
 * @date 2012-7-12下午12:58:31
 * 
 */
public class Constant {

	public static final String DEFAULT_AVATAR = "resources/images/avatar.jpg";

	public static Map<String, String> getHeader(HttpHeaders headers) {
		Map<String, String> data = Maps.newHashMap();
		if (headers != null) {
			MultivaluedMap<String, String> map = headers.getRequestHeaders();
			Set<Entry<String, List<String>>> set = map.entrySet();
			for (Entry<String, List<String>> entry : set) {
				if (entry != null) {
					List<String> v = entry.getValue();
					if (v != null && v.size() > 0) {
						data.put(entry.getKey(), v.get(0));
					}
				}
			}
		}
		return data;
	}

	/**
	 * 发送系统邮件服务器主机地址
	 */
	public static final String EMAIL_SMTP_HOST = "email.smtp.host";
	
	/**
	 * 发送系统邮件帐号 KEY
	 */
	public static final String EMAIL_SERVICE_USERNAME = "email.service.username";
	
	/**
	 * 发送邮件帐号密码 KEY
	 */
	public static final String EMAIL_SERVICE_PASSWORD = "email.service.password";
	
	/**
	 * 找回密码邮件主题  KEY
	 */
	public static final String EMAIL_FIND_PASSWORD_SUBJECT = "email.service.findpassword.subject";
	
	/**
	 * 找回密码邮件内容模版 KEY 
	 */
	public static final String EMAIL_FIND_PASSWORD_CONTENT = "email.service.findpassword.content";
	
	/**
	 * 获取UUid
	 * @return
	 */
	public static String random(){
		return UUID.randomUUID().toString().replaceAll("-","");
	}
}
